'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 任务的工厂类
 * @author sundbcn@gmail.com (sun debing)
 */

var taskType = require('../consts/taskType');
var taskBattleDefWinNum = require('./task/taskBattleDefWinNum');
var taskBattleEarnGoldOneTime = require('./task/taskBattleEarnGoldOneTime');
var taskBattleEarnTotalGold = require('./task/taskBattleEarnTotalGold');
var taskBattleNum = require('./task/taskBattleNum');
var taskBattleWinNum = require('./task/taskBattleWinNum');
var taskClearRuinNum = require('./task/taskClearRuinNum');
var taskCompose = require('./task/taskCompose');
var taskCupNum = require('./task/taskCupNum');
var taskEquipReset = require('./task/taskEquipReset');
var taskEquipUpgrade = require('./task/taskEquipUpgrade');
var taskFreeEnergyNum = require('./task/taskFreeEnergyNum');
var taskHeroLv = require('./task/taskHeroLv');
var taskHeroSkillLv = require('./task/taskHeroSkillLv');
var taskUpgradeNexusNum = require('./task/taskUpgradeNexusNum');
var taskPassCopy = require('./task/taskPassCopy');
var taskPassCopyNum = require('./task/taskPassCopyNum');
var taskProtectTime = require('./task/taskProtectTime');
var taskRank = require('./task/taskRank');
var taskRankFightNum = require('./task/taskRankFightNum');
var taskStar3Copy = require('./task/taskStar3Copy');
var taskTotalDiamond = require('./task/taskTotalDiamond');
var taskTotalGold = require('./task/taskTotalGold');
var taskSoldierStar = require('./task/taskSoldierStar');
var taskUnlockSkillSelect = require('./task/taskUnlockSkillSelect');
var taskUpgradeSoldierNum = require('./task/taskUpgradeSoldierNum');
var taskUnlockSoldierSelect = require('./task/taskUnlockSoldierSelect');
var taskUnlockTower = require('./task/taskUnlockTower');
var taskWorldBossNum = require('./task/taskWorldBossNum');
var taskAltar = require('./task/taskAltar');
var taskMine = require('./task/taskMine');
var taskChest = require('./task/taskChest');
var taskFarm = require('./task/taskFarm');
var taskBarn = require('./task/taskBarn');
var taskParade = require('./task/taskParade');
var taskAirship = require('./task/taskAirship');
var taskSmithy = require('./task/taskSmithy');
var taskWall = require('./task/taskWall');
var taskMarchhall = require('./task/taskMarchhall');
var taskAtelier = require('./task/taskAtelier');
var taskHerocollege = require('./task/taskHerocollege');
var taskSoldiercollege = require('./task/taskSoldiercollege');
var taskAcademy = require('./task/taskAcademy');
var taskWishtree = require('./task/taskWishtree');

var taskBuildUpgrade = require('./task/taskBuildUpgrade');
var taskSecretSweep = require('./task/taskSecretSweep');
var taskLuckitem = require('./task/taskLuckitem');
var taskBuyResources = require('./task/taskBuyResources');
var taskRefreshMarket = require('./task/taskRefreshMarket');
var taskReceiveResources = require('./task/taskReceiveResources');
var taskBattleNumNum = require('./task/taskBattleNumNum');
var taskBattleSuccess = require('./task/taskBattleSuccess');
var taskBattleDefense = require('./task/taskBattleDefense');
var taskFriendsDiamond = require('./task/taskFriendsDiamond');
var taskWirkdCgat = require('./task/taskWirkdCgat');
var taskEquipUpgrade = require('./task/taskEquipUpgrade');
var taskCompleteWishtree = require('./task/taskCompleteWishtree');
var taskCompleteSweep = require('./task/taskCompleteSweep');
var taskInSurvival = require('./task/taskInSurvival');
var taskInMorgui = require('./task/taskInMorgui');
var taskBuyCard = require('./task/taskBuyCard');
var taskReceiveSp = require('./task/taskReceiveSp');
var taskSkill = require('./task/taskSkill');
var taskTech = require('./task/taskTech');
var taskConsume = require('./task/taskConsume');
var taskEquip = require('./task/taskEquip');
var taskRoad = require('./task/taskRoad');
var taskBattleOneNum = require('./task/taskBattleOneNum');

var taskRoadBlock = require('./task/taskRoadBlock');
var taskBarrack = require('./task/taskBarrack');
var taskDefense = require('./task/taskDefense');
var taskRoadBlock = require('./task/taskRoadBlock');
var taskUpgradeRoad = require('./task/taskUpgradeRoad');
var taskBuyMarket = require('./task/taskBuyMarket');

var taskDifBuildStarFive = require('./task/taskDifBuildStarFive');
var taskSoldierStarFive = require('./task/taskSoldierStarFive');
var taskSoldierStarAll = require('./task/taskSoldierStarAll');
var taskUpgradeSoldier = require('./task/taskUpgradeSoldier');
var taskUpgradeDefBuildStart = require('./task/taskUpgradeDefBuildStart');

var taskcopyStarTotal = require('./task/taskcopyStarTotal');
var taskSoldierNumStarTotal = require('./task/taskSoldierNumStarTotal');
var taskBuildDefStarNumTotal = require('./task/taskBuildDefStarNumTotal');
var taskSoldierLvlNumTotal = require('./task/taskSoldierLvlNumTotal');
var taskArenaWinNum = require('./task/taskArenaWinNum');
var taskCompleteUnionTaskNum = require('./task/taskCompleteUnionTaskNum');
var taskSmithyForgingNum = require('./task/taskSmithyForgingNum');
var taskUnionHelpNum = require('./task/taskUnionHelpNum');
var taskGoldFoodCopyNum = require('./task/taskGoldFoodCopyNum');
var taskJoinChatBossNum = require('./task/taskJoinChatBossNum');
var taskCompleteEverydayNum = require('./task/taskCompleteEverydayNum');
var taskHeroEquiLvTotal = require('./task/taskHeroEquiLvTotal');
var taskUnionDonationNum = require('./task/taskUnionDonationNum');
var taskPvpCupNum = require('./task/taskPvpCupNum');

var taskCompleteHeroEquitUp = require('./task/taskCompleteHeroEquitUp');
var taskUpTechNum = require('./task/taskUpTechNum');
var taskCompleteMorguiNum = require('./task/taskCompleteMorguiNum');
var taskCoupleteTrainNum = require('./task/taskCoupleteTrainNum');
var taskCompleteResourcesReceive = require('./task/taskCompleteResourcesReceive');
var taskCompleteSmithyForging = require('./task/taskCompleteSmithyForging');
var taskCompleteChatMsg = require('./task/taskCompleteChatMsg');
var taskCompleteUnionBoos = require('./task/taskCompleteUnionBoos');
var taskCompleteMilitaryExploit = require('./task/taskCompleteMilitaryExploit');
var taskCompleteLuckyNum = require('./task/taskCompleteLuckyNum');
var taskCompleteLuckyBoxNum = require('./task/taskCompleteLuckyBoxNum');
var taskCompleteHeroConstellation = require('./task/taskCompleteHeroConstellation');
var taskCompleteSoldierTalent = require('./task/taskCompleteSoldierTalent');
var taskBuyNumEnergy = require('./task/taskBuyNumEnergy');
var taskArenaJoinNum = require('./task/taskArenaJoinNum');

var task_instances = {};

// 1.金币成就
task_instances[taskType.TOTAL_GOLD] = function () {
    return taskTotalGold;
};

// 2.钻石成就
task_instances[taskType.TOTAL_DIAMOND] = function () {
    return taskTotalDiamond;
};

// 3.副本成就
task_instances[taskType.STAR_3_COPY] = function () {
    return taskStar3Copy;
};

// 4.城堡成就
task_instances[taskType.UPGRADE_NEXUS_NUM] = function () {
    return taskUpgradeNexusNum;
};

// 5.英雄等级成就
task_instances[taskType.HERO_LV] = function () {
    return taskHeroLv;
};

// 6.PVP次数
task_instances[taskType.BATTLE_NUM] = function () {
    return taskBattleNum;
};

// 7.PVP胜场
task_instances[taskType.BATTLE_WIN_NUM] = function () {
    return taskBattleWinNum;
};

// 8.PVP掠夺成就
task_instances[taskType.BATTLE_EARN_TOTAL_GOLD] = function () {
    return taskBattleEarnTotalGold;
};

// 9.PVP掠夺破纪录
task_instances[taskType.BATTLE_EARN_GOLD_ONE_TIME] = function () {
    return taskBattleEarnGoldOneTime;
};

// 10.PVP防御
task_instances[taskType.BATTLE_DEF_WIN_NUM] = function () {
    return taskBattleDefWinNum;
};

// 11.升级兵种次数
task_instances[taskType.UPGRADE_SOLDIER_NUM] = function () {
    return taskUpgradeSoldierNum;
};

// 12.士兵星级     （功能删除）
task_instances[taskType.SOLDIER_STAR] = function () {
    return taskSoldierStar;
};

// 13.解锁技能槽
task_instances[taskType.UNLOCK_SKILL_SELECT] = function () {
    return taskUnlockSkillSelect;
};

// 14.解锁士兵槽
task_instances[taskType.UNLOCK_SOLDIER_SELECT] = function () {
    return taskUnlockSoldierSelect;
};

// 15.英雄技能等级
task_instances[taskType.HERO_SKILL_LV] = function () {
    return taskHeroSkillLv;
};

// 16.建造n个防御塔
task_instances[taskType.UNLOCK_TOWER] = function () {
    return taskUnlockTower;
};

// 17.拆除废墟     （功能删除）
task_instances[taskType.CLEAR_RUIN_NUM] = function () {
    return taskClearRuinNum;
};

// 18.奖杯成就
task_instances[taskType.CUP_NUM] = function () {
    return taskCupNum;
};

// 19.护盾使用
task_instances[taskType.PROTECT_TIME] = function () {
    return taskProtectTime;
};

// 20.竞技场排名到多少以内     （功能删除）
task_instances[taskType.RANK] = function () {
    return taskRank;
};

// 21.升级N级金矿
task_instances[taskType.UPGRADE_MINE_NUM] = function () {
    return taskMine;
};

// 22.升级N级金库
task_instances[taskType.UPGRADE_CHEST_NUM] = function () {
    return taskChest;
};

// 23.升级N级农场
task_instances[taskType.UPGRADE_FARM_NUM] = function () {
    return taskFarm;
};

// 24.升级N级粮仓
task_instances[taskType.UPGRADE_BARN_NUM] = function () {
    return taskBarn;
};

// 25.升级N级练兵场     （功能删除）
task_instances[taskType.UPGRADE_PARADE_NUM] = function () {
    return taskParade;
};

// 26.升级N级飞艇     （功能删除）
task_instances[taskType.UPGRADE_AIRSHIP_NUM] = function () {
    return taskAirship;
};

// 27.升级N级祭坛     （功能删除）
task_instances[taskType.UPGRADE_ALTAR_NUM] = function () {
    return taskAltar;
};

// 28.升级N级铁匠铺     （功能删除）
task_instances[taskType.UPGRADE_SMITHY_NUM] = function () {
    return taskSmithy;
};

// 29.升级N级城墙
task_instances[taskType.UPGRADE_WALL_NUM] = function () {
    return taskWall;
};

// 30.升级N级行军大厅
task_instances[taskType.UPGRADE_MARCHHALL_NUM] = function () {
    return taskMarchhall;
};

// 31.升级N级指挥中心     （功能删除）
task_instances[taskType.UPGRADE_ATELIER_NUM] = function () {
    return taskAtelier;
};

// 32.升级N级英雄学院
task_instances[taskType.UPGRADE_HEROCOLLEGE_NUM] = function () {
    return taskHerocollege;
};

// 33.升级N级士兵学院     （功能删除）
task_instances[taskType.UPGRADE_SOLDIERCOLLEGE_NUM] = function () {
    return taskSoldiercollege;
};

// 34.升级N级研究院
task_instances[taskType.UPGRADE_ACADEMY_NUM] = function () {
    return taskAcademy;
};

// 35.升级N级许愿树
task_instances[taskType.UPGRADE_WISHTREE_NUM] = function () {
    return taskWishtree;
};

// 36.升级技能
task_instances[taskType.UPGRADE_SKILL_NUM] = function () {
    return taskSkill;
};

// 37.升级科技
task_instances[taskType.UPGRADE_TECH_NUM] = function () {
    return taskTech;
};

// 38.兑换物品
task_instances[taskType.UPGRADE_CONSUME_NUM] = function () {
    return taskConsume;
};

// 39.提升装备
task_instances[taskType.UPGRADE_EQUIP_NUM] = function () {
    return taskEquip;
};

// 40.改造道路任务
task_instances[taskType.UPGRADE_ROAD_NUM] = function () {
    return taskRoad;
};

// 41.兵营升级任务
task_instances[taskType.UPGRADE_BARRACK_NUM] = function () {
    return taskBarrack;
};

// 42.防御塔升级任务      （功能删除）
task_instances[taskType.UPGRADE_DEFENSE_NUM] = function () {
    return taskDefense;
};

// 43.路障升级任务      （功能删除）
task_instances[taskType.UPGRADE_ROAD_BLOCK_NUM] = function () {
    return taskRoadBlock;
};

// 44.地雷升级任务      （功能删除）
task_instances[taskType.UPGRADE_LANDMINE] = function () {
    return taskUpgradeRoad;
};

// 47.5星防御塔任务
task_instances[taskType.DEF_BUILD_STAR_FIVE] = function () {
    return taskDifBuildStarFive;
};

// 48.5星士兵任务
task_instances[taskType.SOLDIER_STAR_FIVE] = function () {
    return taskSoldierStarFive;
};

// 49.士兵升星任务
task_instances[taskType.SOLDIER_STAR_ALL] = function () {
    return taskSoldierStarAll;
};

// 50.士兵升级任务(记录最士兵等级)
task_instances[taskType.UPGRADE_SOLDIER] = function () {
    return taskUpgradeSoldier;
};

// 51.防御塔强化
task_instances[taskType.UPGRADE_DEFBUILD_START] = function () {
    return taskUpgradeDefBuildStart;
};

// 101.主线副本任务
task_instances[taskType.PASS_COPY] = function () {
    return taskPassCopy;
};

// 202.进行N次战役
task_instances[taskType.PASS_COPY_NUM] = function () {
    return taskPassCopyNum;
};
// 203.进行N次竞技场挑战
task_instances[taskType.RANK_FIGHT_NUM] = function () {
    return taskRankFightNum;
};

// 204.进行N次道具融合      （功能删除）
task_instances[taskType.COMPOSE] = function () {
    return taskCompose;
};

// 205.进行N次装备强化     （功能删除）
task_instances[taskType.EQUIP_UPGRADE] = function () {
    return taskEquipUpgrade;
};

// 206.进行N次装备重铸     （功能删除）
task_instances[taskType.EQUIP_RESET] = function () {
    return taskEquipReset;
};

// 207.挑战N次世界BOSS     （功能删除）
task_instances[taskType.WORLD_BOSS_NUM] = function () {
    return taskWorldBossNum;
};

// 208.领取体力N次
task_instances[taskType.FREE_ENERGY_NUM] = function () {
    return taskFreeEnergyNum;
};

// 209.成功升级任意一个建筑
task_instances[taskType.BUILD_UPGRADE_TASK_NUM] = function () {
    return taskBuildUpgrade;
};

// 210.扫荡关卡N次
task_instances[taskType.SECRETSWEEP_NUM] = function () {
    return taskSecretSweep;
};

// 211.完成N次任意抽卡
task_instances[taskType.LUCKITEM_NUM] = function () {
    return taskLuckitem;
};

// 212.购买N次粮食或金币
task_instances[taskType.BUY_RESOURCES_NUM] = function () {
    return taskBuyResources;
};

// 213.刷新N次市场
task_instances[taskType.REFRESH_MARKET_NUM] = function () {
    return taskRefreshMarket;
};

// 214.收取N次粮食或金币
task_instances[taskType.RECEIVE_RESOURCES_NUM] = function () {
    return taskReceiveResources;
};

// 215.尝试掠夺1名玩家
task_instances[taskType.BATTLE_ONE_NUM] = function () {
    return taskBattleOneNum;
};

// 216.尝试掠夺N名玩家
task_instances[taskType.BATTLE_NUM_NUM] = function () {
    return taskBattleNumNum;
};

// 217.尝试掠夺n名玩家成功
task_instances[taskType.BATTLE_SUCCESS_NUM] = function () {
    return taskBattleSuccess;
};

// 218.进行N次防守模拟战
task_instances[taskType.BATTLE_DEFENSE_NUM] = function () {
    return taskBattleDefense;
};

// 219.给N位好友赠送钻石
task_instances[taskType.FRIENDS_DIAMOND_NUM] = function () {
    return taskFriendsDiamond;
};

// 220.世界聊天发送N次消息     （功能删除）
task_instances[taskType.WORLD_CHAT_NUM] = function () {
    return taskWirkdCgat;
};

// 221.完成N次装备提升     （功能删除）
task_instances[taskType.EQUIP_UPGRADE_NUM] = function () {
    return taskEquipUpgrade;
};

// 222.完成N次许愿
task_instances[taskType.COMPLETE_WISHTREE_NUM] = function () {
    return taskCompleteWishtree;
};

// 223.完成N次叛军来袭
task_instances[taskType.COMPLETE_SWEEP_NUM] = function () {
    return taskCompleteSweep;
};

// 224.参加N次生存挑战
task_instances[taskType.IN_SURVIVAL_NUM] = function () {
    return taskInSurvival;
};

// 225.参加N次魔窟远征
task_instances[taskType.IN_MORGUI_NUM] = function () {
    return taskInMorgui;
};

// 226.购买月卡，每天可领取N钻石
task_instances[taskType.BUY_CARD_NUM] = function () {
    return taskBuyCard;
};

// 227.每天12点至14点领取N点体力
task_instances[taskType.RECEIVE_SP_NUM] = function () {
    return taskReceiveSp;
};

// 228.完成N次市场购买
task_instances[taskType.RECEIVE_MARKET_NUM] = function () {
    return taskBuyMarket;
};
//-----------------------------开服7天活动统计
// 301.通关副本累计获得N星
task_instances[taskType.COPY_STAR_TOTAL] = function () {
    return taskcopyStarTotal;
};

// 303.拥有n星士兵的N个
task_instances[taskType.SOLDIER_NUM_STAR_TOTAL] = function () {
    return taskSoldierNumStarTotal;
};

// 304.拥有n星防御塔N个
task_instances[taskType.BUILD_DEF_STAR_NUM_TOTAL] = function () {
    return taskBuildDefStarNumTotal;
};

// 305.拥有N级士兵N个
task_instances[taskType.SOLDIER_LVL_NUM_TOTAL] = function () {
    return taskSoldierLvlNumTotal;
};

// 310.竞技场挑战胜利次数
task_instances[taskType.ARENA_WIN_NUM] = function () {
    return taskArenaWinNum;
};

// 311.完成联盟任务次数
task_instances[taskType.COMPLETE_UNION_TASK_NUM] = function () {
    return taskCompleteUnionTaskNum;
};

// 312.铁匠铺锻造次数
task_instances[taskType.SMITHY_FORGING_NUM] = function () {
    return taskSmithyForgingNum;
};

// 313.联盟帮助次数
task_instances[taskType.UNION_HELP_NUM] = function () {
    return taskUnionHelpNum;
};

// 314.金币，粮食副本次数
task_instances[taskType.GOLD_FOOD_COPY_NUM] = function () {
    return taskGoldFoodCopyNum;
};

// 315.参与世界BOSS次数
task_instances[taskType.JOIN_CHAT_BOSS_NUM] = function () {
    return taskJoinChatBossNum;
};

// 316.完成每日任务次数
task_instances[taskType.COMPLETE_EVERYDAY_ACTIVE_NUM] = function () {
    return taskCompleteEverydayNum;
};

// 317.英雄穿戴装备全部升级到10级
task_instances[taskType.HERO_EQUI_LV_TOTAL] = function () {
    return taskHeroEquiLvTotal;
};

// 318.联盟捐赠次数
task_instances[taskType.UNION_DONATION_NUM] = function () {
    return taskUnionDonationNum;
};

// 319.pvp奖杯达到N
task_instances[taskType.PVP_CUP_NUM] = function () {
    return taskPvpCupNum;
};

//-------------------------------------- 6-28
// 320.升级任务N次科技 （功能已重复）
task_instances[taskType.UP_TECH_NUM] = function () {
    return taskUpTechNum;
};

// 322.完成任务n次魔窟远征玩法
task_instances[taskType.COMPLETE_MORGUI_NUM] = function () {
    return taskCompleteMorguiNum;
};

// 323.次试练玩法
task_instances[taskType.COMPLETE_TRAIN_NUM] = function () {
    return taskCoupleteTrainNum;
};

// 324.完成n次英雄装备 强化
task_instances[taskType.COMPLETE_HERO_EQUIT_UP] = function () {
    return taskCompleteHeroEquitUp;
};

// 325.完成n 次资源收取
task_instances[taskType.COMPLETE_RESOURCES_RECEIVE] = function () {
    return taskCompleteResourcesReceive;
};

// 326.完成任意n 次铁匠锻造
task_instances[taskType.COMPLETE_SMITHY_FORGING] = function () {
    return taskCompleteSmithyForging;
};

// 327.完成n 次世界发言
task_instances[taskType.COMPLETE_CHAT_MSG] = function () {
    return taskCompleteChatMsg;
};

// 328.完成n 次联盟boos挑战
task_instances[taskType.COMPLETE_UNION_BOOS] = function () {
    return taskCompleteUnionBoos;
};

// 329.完成任意 n 次军功宝箱开启
task_instances[taskType.COMPLETE_MILITARY_EXPLOIT] = function () {
    return taskCompleteMilitaryExploit;
};

// 330.完成任意 n次大转盘
task_instances[taskType.COMPLETE_LUCKY_NUM] = function () {
    return taskCompleteLuckyNum;
};

// 331.完成任意n 次幸运宝箱抽奖
task_instances[taskType.COMPLETE_LUCKY_BOX_NUM] = function () {
    return taskCompleteLuckyBoxNum;
};

// 332.英雄 天赋觉醒n  次
task_instances[taskType.COMPLETE_HERO_CONSTELLATION] = function () {
    return taskCompleteHeroConstellation;
};

// 333.英雄 天赋觉醒n次
task_instances[taskType.COMPLETE_SOLDIER_TALENT] = function () {
    return taskCompleteSoldierTalent;
};

// 334.购买 n 次体力
task_instances[taskType.BUY_NUM_ENERGY] = function () {
    return taskBuyNumEnergy;
};

// 335.竞技场参与次数
task_instances[taskType.ARENA_JOIN_NUM] = function () {
    return taskArenaJoinNum;
};

//-----------------------------开服7天活动统计  end
/**
 * 获取任务类
 * @param  {[type]} task_static_type [description]
 * @return {[type]}                  [description]
 */
exports.getInstance = function (task_static_type) {
    var instance = task_instances[task_static_type];
    if (!!instance) {
        return instance();
    } else {
        throw new Error('task static type can not found:' + task_static_type);
    }
};
